<?php

namespace app\student\controller;

use app\student\security\StuCheck as StuCheckLogic;
use app\student\model\Thesis as ThesisModel;
use app\student\security\Auth as AuthLogic;
use think\Controller;
use think\Session;

class MoreThesis extends Controller
{
    /**
     * 登录界面显示，自动登录
     * @access public
     * @return mixed 返回登录视图
     */
    public function moreThesis($tisId = '')
    {
        $stuCheck = new StuCheckLogic();
        //检测学生登录情况
        if ($stuCheck->check()) {
            //检测是否有审核员权限
            $auth = new AuthLogic();
            //获取学号
            $username = Session::get('token')['stuUsername'];
            if ($auth->check('selectmore', $username)) {
                //是否是选题阶段
                if (getSrvConfig()['srvStatus'] == 4) {
                    $thesis = new ThesisModel();
                    if ($result = $thesis::where('tisId', $tisId)->find()) {
                        $this->assign('thesis', $result);
                        return $this->fetch('moreThesis/moreThesis');
                    } else {
                        return "没有查询到题目，请稍后再试";
                    }
                } else {
                    return "目前不是选题阶段";
                }
            } else {
                return "500：您没查看题目的权限";
            }
        } else {
            return "600：您的登录信息出现问题，请重新登录"
            . "<br>" . "1.您的帐号在其他地方登录"
            . "<br>" . "2.您在线时间过长（5小时以上）"
            . "<br>" . "3.令牌验证错误";
        }
    }

}